<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../template/taglib.jsp"%>

<jsp:include page="../template/header.jsp" />

<jsp:include page="../template/adminmenu.jsp" />

<%-- content template --%>
<jsp:include page="../template/contentheader.jsp" />
<%-- put content here --%>
<fmt:setBundle basename="admin" />
<c:set var="t" value="true" />
<h2>
	<fmt:message key="label.hierarchyrole.manage" />
</h2>
<form action="/LeaveApplicationProcessingSystem/AdminManageHierarchy"
	method="post">
	<table cellpadding="4" cellspacing="2" border="0">
		<tr>
			<td width="130"><fmt:message key="label.hierarchyrole" />
			</td>
			<td><c:if test="${param['manage']==t}">
				${param['name']}
				<input type="hidden" name="type" value="manage" />
					<input type="hidden" name="supervisorusertype" value="${param.supervisorusertype}" />
					<input type="hidden" name="name" value="${param.name}" />
				</c:if>
			</td>
		</tr>
		<tr>
			<td><fmt:message key="label.hierarchyrole.subordinate" />
			</td>
			<td><c:if test="${param['manage']==t}">
					<select name="usertype">
						<c:forEach var="userType" items="${userTypes}">
							<option value="${userType.id}">
								<c:out value="${userType.name}" />
							</option>
						</c:forEach>
					</select>
				</c:if>
			</td>
		</tr>
		<tr>
			<td><input type="submit" value="Submit">
			</td>
		</tr>
	</table>
	<c:if test="${subordinateUserTypes.size() > 0}">
		<table>
			<tr>
				<th><fmt:message key="label.hierarchyrole.subordinaterole" />
				</th>
				<th><fmt:message key="label.hierarchyrole.annualleave" /></th>
				<th><fmt:message key="label.hierarchyrole.medicalleave" /></th>
				<th><fmt:message key="label.hierarchyrole.delete" /></th>
			</tr>
			<c:forEach var="subordinateUserType" items="${subordinateUserTypes}">
				<tr>
					<td><c:out value="${ subordinateUserType.name }" /></td>
					<td><c:out value="${ subordinateUserType.annualLeave }" /></td>
					<td><c:out value="${ subordinateUserType.medicalLeave }" /></td>
					<td><c:url var="deleteUrl" scope="page"
							value="/AdminManageHierarchy">
							<c:param name="id" value="${subordinateUserType.id}" />
							<c:param name="supervisorusertype" value="${param.supervisorusertype}" />
							<c:param name="type" value="delete" />
							<c:param name="name" value="${param.name}" />
						</c:url> <a href="${deleteUrl}"><fmt:message
								key="label.hierarchyrole.delete" /> </a>
					</td>
				</tr>
			</c:forEach>
		</table>
	</c:if>
</form>
<jsp:include page="../template/contentfooter.jsp" />
<%-- end of content template --%>

<jsp:include page="../template/footer.jsp" />